package com.cjst.controller.base;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.cjst.pojo.base.ShortMessage;
import com.cjst.service.base.ShortMessageService;
import com.cjst.sql.C;
import com.cjst.sql.Method;
import com.cjst.sql.WherePrams;
import com.cjst.util.code.PageUtil;

@Controller
@RequestMapping("/base/shortMessage")
public class ShortMessageController extends BaseController{
	
	@Autowired
	private ShortMessageService shortMessageService;
	
	@RequestMapping(value = "", method = RequestMethod.GET)
	public String toDept() {
	    return "base/shortMessage/list";
	}
	@RequestMapping(value = "/list", method = RequestMethod.POST)
	@ResponseBody
	public Object list(String smsSign,String smsCode,String smsTemplate,Integer isSuccess,Integer smsClzz) {
	    WherePrams wherePrams = Method.where("isDelete", C.EQ, "0");
	    if(smsSign!=null && smsSign.length()>0){
	    	wherePrams.and("smsSign", C.LIKE, smsSign,1);
	    }
	    if(smsCode!=null && smsCode.length()>0){
	    	wherePrams.and("smsCode", C.LIKE, smsCode,1);
	    }
	    if(smsTemplate!=null && smsTemplate.length()>0){
	    	wherePrams.and("smsTemplate", C.LIKE, smsTemplate,1);
	    }
	    if(isSuccess!=null){
	    	wherePrams.and("isSuccess", C.LIKE, isSuccess);
	    }
	    if(smsClzz!=null){
	    	wherePrams.and("smsClzz", C.LIKE, smsClzz);
	    }
	    PageUtil<ShortMessage> pageUtil = shortMessageService.listPageCount(wherePrams);
	    return super.packForBT(pageUtil);
	}
}
